L1-005 考试座位号
题目 考试座位号
思路分析
用map pair
代码实现
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef pair<string, int> PII;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
map<int, PII> local;
int total;
cin >> total;
string n1;
int n2, n3;
while (total--) {
cin >> n1 >> n2 >> n3;
local[n2] = {n1, n3};
}
int q;
cin >> q;
while (q--) {
int query_key;
cin >> query_key;
cout << local[query_key].first << " " << local[query_key].second << endl;
}
return 0;
}
同类题型
视频讲解
⬅️ L1-004 计算摄氏温度 🏠 00-天梯赛 ➡️ L1-006 连续因子
💬 评论